package com.pro.controller;

import com.pro.entry.JsComment;
import com.pro.service.JsCommentService;
import com.pro.utils.JsonData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * ClassName:JsCommentController
 * Package:com.pro.controller
 * Description:
 *
 * @Date:2022/4/12 15:09
 * @Author: ZPT
 */
@RestController
@RequestMapping("/comment")
public class JsCommentController {


    @Autowired
    private JsCommentService commentService;

    /**
     * @author ZPT
     * @content :查询评论信息
     */
    @GetMapping("/getComment")
    public JsonData getComment(Integer commodityId, Integer type){
        List<JsComment> commentList = commentService.getComment(commodityId, type);
        return commentList!=null?JsonData.buildSuccess(commentList):JsonData.buildError("服务端错误");
    }
}
